import request from "@/utils/request";

export const getNodeList = (params) => {
  return request({
    url: "/node/info/list",
    method: "get",
    params,
  });
};

export const createNode = (data) => {
  return request({
    url: "/node/info",
    method: "post",
    data,
  });
};

export const updateNode = (data) => {
  return request({
    url: "/node/info",
    method: "put",
    data,
  });
};

export const getNodeDetail = (id) => {
  return request({
    url: `/node/info/${id}`,
    method: "get",
  });
};

export const toggleNodeStatus = (data) => {
  return request({
    url: "/node/info/updateStatus",
    method: "put",
    data,
  });
};

export const getNodeMembers = (params) => {
  return request({
    url: "/node/user/list",
    method: "get",
    params,
  });
};

export const addNodeUser = (data) => {
  return request({
    url: "/node/user",
    method: "post",
    data,
  });
};

export const createNodeUser = (data) => {
  return request({
    url: "/node/user/createUser",
    method: "post",
    data,
  });
};

export const removeNodeUser = (params) => {
  return request({
    url: "/node/user/delete",
    method: "delete",
    params,
  });
};

export const getNodeServerTask = (params) => {
  return request({
    url: "/node/info/search",
    method: "get",
    params,
  });
};

export const pollingGetServerInfo = (params) => {
  return request({
    url: "/node/task/searchRet",
    method: "get",
    params,
  });
};

export const getNodeSearchLogList = (params) => {
  return request({
    url: "/node/task/searchLog",
    method: "get",
    params,
  });
};

export const getNodeUploadLogList = (params) => {
  return request({
    url: "/node/task/uploadLog",
    method: "get",
    params,
  });
};

export const getNodeUploadDetail = (params) => {
  return request({
    url: "/node/task/uploadDetail",
    method: "get",
    params,
  });
};
